<?php
class CategoryModel
{
	private $category_db;
	private $category_wlp_db;
	
	public function __construct()
	{
		$this->category_db = new CategoryDb();
		$this->category_wlp_db = new CategoryWlpDb();
	}
	
	public function getCategoryNameById($category_id)
	{
		$where = array(
			'id' => $category_id
		);
		$column = array('name');
		$result = $this->category_db->selectRow($where,$column);
		return $result['name'];
	}
	
	public function getAllCategoriesIdAndName()
	{
		$where = array(
			
		);
		$result = $this->category_db->selectRows($where);
		$data = array();
		foreach($result as $value)
		{
			$data[$value['id']] = $value['name'];
		}
		return $data;
	}
	
	public function getAllCategoriesWlp($written_language_id)
	{
		return array(
			'1' => 'CPU',
			'2' => '显卡',
		);
		$where = array(
			'name' => $name
		);
		$result = $this->user_db->selectRow($where);
		return $result;
	}
	
	public function getAllCategoriesNameAndDisplay($written_language_id)
	{
		$where = array(
			'written_language_id' => $written_language_id
		);
		$column = array('display','name');
		$result = $this->category_wlp_db->selectRows($where,$column);
		$data = array();
		foreach($result as $value)
		{
			$data[$value['name']] = $value['display'];
		}
		return $data;
	}
}
?>